package ch.gislb2.interf;

import ch.gislb2.exceptions.IntegratorException;

/**
* In order to get accurate data (over time) from a 'pure' sensor, an integrator
* should be used. This integrator acts as a LowPassFilter, that cancels out the
* intrinsic noise of the sensor. The frequency is defined as the time between
* two samples with different amplitude. The amplitude is defined as the value
* per sample.
*
* @author Simplix
*
*/
public interface Integrator {

   /**
    *
    * @param maxNoiseError
    *            is equal to the max amplitude of the filter which has to be
    *            represented by a positive value.
    * @throws IntegratorException
    *             If the value is not within the expected range
    */
   public abstract void setMaxNoiseError(final int maxNoiseError) throws IntegratorException;

   /**
    * @param value
    *            amplitude of the Sample
    */
   public abstract void addSample(final float value);

   /**
    * Sample
    *
    * @param value
    *            amplitude of the Sample
    */
   public abstract void addSample(final int value);

   /**
    * Clears the sampleSet used for the integration
    */
   public abstract void clear();

   /**
    * Calculates the integration over the used sampleSet
    *
    * @return
    */
   public abstract int getAverage();

}
